<template>
  <div id="nav">
    <div class="content nav">
      <div @click="togo('/')">孔丘在线旅游系统</div>
      <div @click="togo('/')">首页</div>
        <div><a href="#scenicSpot">景区信息</a></div>
      <div><a href="#food">美食信息</a></div>
      <div><a href="#line">酒店信息</a></div>
      <div @click="togo('/comment')">在线留言</div>
      <div @click="togo('/person')" v-if="isLogin == 1">个人中心</div>
    </div>
  </div>
</template>

<script setup>
import { useRouter } from "vue-router";
import { computed } from "vue";

const isLogin = computed(() => {
  return localStorage.isLogin || 0;
});

const router = useRouter();
const togo = (path) => {
  router.push(path);
};
</script>

<style lang="scss" scoped>
#nav {
  height: 55px;
  background: #f38e48;
  .nav {
    height: 100%;
    align-items: center;
    justify-content: space-between;
    color: white;
    div {
      cursor: pointer;
      font-size: 18px;
    }
  }
  a{
    color: #fff;
    text-decoration: none;
  }
}
</style>
